package holdtime.xlxc.base;

import android.content.Context;

import java.util.Properties;

import holdtime.xlxc.R;

public class BaseAddress {

    public String serverAddress(Context context) {
        String ip = propertiesUrl(context, "serverIP");
//        String port = propertiesUrl(context, "serverPort");
        String projectName = propertiesUrl(context, "projectName");
        return ip + "/" + projectName;
    }

    public String yc_serverAddress(Context context) {
        String ip = propertiesUrl(context, "yc_serverIP");
//        String port = propertiesUrl(context, "serverPort");
        String projectName = propertiesUrl(context, "yc_projectName");
        return ip + "/" + projectName;
    }

    public String checkKey(Context context) {
        return propertiesUrl(context, "mobileCheckKey");
    }

    private String propertiesUrl(Context context, String string) {
        String str = "";
        Properties properties = new Properties();
        try {
            properties.load(context.getResources().openRawResource(R.raw.config));
            str = properties.getProperty(string);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return str;
    }
}
